/*
 *
 * Copyright (c) 2020-2022, Java知识图谱 (http://www.altitude.xin).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package xin.altitude.db.redis.sync.domain;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author explore
 * @since 2022/03/04 18:36
 **/
@Data
@NoArgsConstructor
@TableName("bu_order")
public class BuOrder extends Model<BuOrder> {
    @TableId
    private Long orderId;
    private Long userId;
    private Integer orderStatus;
    private Integer payStatus;
    private BigDecimal orderAmount;
    private LocalDateTime createTime;
    private LocalDateTime updateTime;
    
    public BuOrder(Long orderId, Integer orderStatus) {
        this.orderId = orderId;
        this.orderStatus = orderStatus;
    }
    
    /**
     * 用于解析binlog构造器
     *
     * @param row 行
     */
    public BuOrder(Serializable[] row) {
        orderId = (Long) row[0];
        userId = (Long) row[1];
        orderStatus = (Integer) row[2];
        payStatus = (Integer) row[3];
        orderAmount = (BigDecimal) row[4];
        // createTime = (LocalDateTime) row[5];
        // updateTime = (LocalDateTime) row[6];
    }
}
